package com.shuma.shopmanage.usermoudle.controller;

import com.shuma.shopmanage.usermoudle.service.USerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    USerService uSerService;

    @PostMapping("/selectIdByLikeName")
    public List<Long> selectIdByLikeName(String userName){
        List<Long> userIds = uSerService.selectIdByLikeName(userName);
        return userIds;
    }

    @PostMapping("/selectNameById")
    public String selectNameById(Long userId){
        String userName = uSerService.selectNameById(userId);
        return userName;
    }

    @PostMapping("/selectIdByName")
    public Long selectIdByName(String userName){
        Long userId = uSerService.selectIdByName(userName);
        return userId;
    }
}
